package com.boot.admin.modules.sys.ai.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.boot.admin.data.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * AI对话消息表
 *
 * @author 李飞洋
 * @date 2025/9/24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString
@TableName("ai_message")
public class AiMessage extends BaseEntity {
    /**
     * 会话ID
     */
    private String conversationId;
    /**
     * 发送者类型 1:用户 2:AI
     */
    private Integer senderType;
    /**
     * 消息类型 1:文本 2:语音
     */
    private Integer messageType;
    /**
     * 消息内容
     */
    private String content;
    /**
     * 语音文件URL
     */
    private String audioUrl;
    /**
     * 语音时长(秒)
     */
    private Integer audioDuration;
    /**
     * 消息序号
     */
    private Integer messageIndex;
    /**
     * 是否启用
     */
    private Integer isEnabled;

    public boolean isFromUser() {
        return senderType == 1;
    }

    public boolean isFromAi() {
        return senderType == 2;
    }

    public boolean isTextMessage() {
        return messageType == 1;
    }

    public boolean isAudioMessage() {
        return messageType == 2;
    }

    public boolean isEnabled() {
        return isEnabled == 1;
    }
}